from __future__ import unicode_literals
from django.db import models

# Create your models here.
class UserInfo(models.Model):
    username = models.CharField(max_length=20)
    password = models.CharField(max_length=40)

class LunBoTu(models.Model):
    img = models.CharField(max_length=200)
    link = models.CharField(max_length=200)

class ShiZhanTuiJian(models.Model):
    img = models.CharField(max_length=200)
    link = models.CharField(max_length=200)
    label = models.CharField(max_length=50)
    hot = models.CharField(max_length=20,null=True,blank=True)
    title = models.CharField(max_length=200)
    sort = models.CharField(max_length=20,null=True,blank=True)
    level = models.CharField(max_length=20,null=True,blank=True)
    number = models.IntegerField(null=True,blank=True)

class NewClass(models.Model):
    img = models.CharField(max_length=200)
    link = models.CharField(max_length=200)
    label = models.CharField(max_length=50)
    new = models.CharField(max_length=20,null=True,blank=True)
    title = models.CharField(max_length=200)
    sort = models.CharField(max_length=20,null=True,blank=True)
    level = models.CharField(max_length=20,null=True,blank=True)
    number = models.IntegerField(null=True,blank=True)

class NewEntry(models.Model):
    img = models.CharField(max_length=200)
    link = models.CharField(max_length=200)
    label = models.CharField(max_length=50)
    new = models.CharField(max_length=20,null=True,blank=True)
    title = models.CharField(max_length=200)
    sort = models.CharField(max_length=20,null=True,blank=True)
    level = models.CharField(max_length=20,null=True,blank=True)
    number = models.IntegerField(null=True,blank=True)

class SkillUp(models.Model):
    img = models.CharField(max_length=200)
    link = models.CharField(max_length=200)
    label = models.CharField(max_length=50)
    new = models.CharField(max_length=20,null=True,blank=True)
    title = models.CharField(max_length=200)
    sort = models.CharField(max_length=20,null=True,blank=True)
    level = models.CharField(max_length=20,null=True,blank=True)
    number = models.IntegerField(null=True,blank=True)

class CuttingEdge(models.Model):
    img = models.CharField(max_length=200)
    link = models.CharField(max_length=200)
    label = models.CharField(max_length=50)
    new = models.CharField(max_length=20,null=True,blank=True)
    title = models.CharField(max_length=200)
    sort = models.CharField(max_length=20,null=True,blank=True)
    level = models.CharField(max_length=20,null=True,blank=True)
    number = models.IntegerField(null=True,blank=True)

#一级课程分类
# class TypeInfo(models.Model):
#     ttype = models.CharField(max_length=200)
#     def __str__(self):
#         return self.ttype.encode('utf-8')

#二级课程分类
class SubTypeInfo(models.Model):
    sttype = models.CharField(max_length=200)
    stlink = models.CharField(max_length=50)

#一级课程
# class ClassInfo(models.Model):
#     img = models.ImageField(upload_to='course')
#     label = models.CharField(max_length=50)
#     title = models.CharField(max_length=200)
#     level = models.CharField(max_length=20,null=True,blank=True)
#     number = models.IntegerField(null=True,blank=True)
#     content = models.TextField()
#     ctype = models.ForeignKey(TypeInfo)
#     click = models.IntegerField()

#二级课程
class SubClassInfo(models.Model):
    img = models.ImageField(upload_to='course')
    label = models.CharField(max_length=50)
    title = models.CharField(max_length=200)
    level = models.CharField(max_length=20,null=True,blank=True)
    number = models.IntegerField(null=True,blank=True)
    content = models.TextField()
    sctype = models.ForeignKey(SubTypeInfo,on_delete=models.CASCADE)
    click = models.IntegerField(null=True,blank=True)
